package com.ch.enreka.server.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.Duration;
import java.time.Instant;
import java.time.temporal.ChronoField;
import java.time.temporal.ChronoUnit;

/**
 * @author cj-ch
 * @date 2018/6/27 下午5:40
 */
@RestController
@RequestMapping(value = "/test")
public class TestController {

    @Value("${jdbcss}")
    private String jdbcss;

    @RequestMapping
    public String test(){
        System.out.println("test`````:"+jdbcss);

        return jdbcss;
    }

    public static void main(String[] args) {
        Instant n1 = Instant.parse("2018-12-03T03:15:30.00Z");
        Instant n2 = Instant.parse("2018-12-03T20:15:30.00Z");

        System.out.println(n1.truncatedTo(ChronoUnit.DAYS));
        System.out.println(n2.truncatedTo(ChronoUnit.DAYS).plus(1,ChronoUnit.DAYS)
                .minus(1, ChronoUnit.SECONDS)
        );

        System.out.println(n1.isBefore(n2));

    }
}
